<template>
	<view class="content">
		<web-view class="webviews" update-title="false" :src="urls" @message="getMessage"
			@onPostMessage="onpostmsg"></web-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				urls: '',
				id: '',
				objurl: '',
				action: "",
			}
		},
		onLoad(e) {

			this.API_page();
		},
		onShow() {
			uni.switchTab({
				url: '/pages/3d/index'
			})
			// uni.navigateBack({
			// 	delta: 1
			// })
		},
		onShareAppMessage(e) {
			console.log('测试0', e)
		},
		methods: {
			testbrn() {
				conosle.log(this.$refs.webview)
			},
			onpostmsg: function(data) {
				console.log("接收到消息：", data);
			},
			getMessage(e) {
				console.log('测试', e)
				// uni.navigateBack({
				// 	delta: 1
				// })
			},
			API_page() {
				var that = this;
				that.ran
					.request('/app-api/model/user-space/page', {
						pageNo: 1,
						pageSize: 1,
					}, 'POST')
					.then(res => {
						console.log(res);
						if (res.code == 200) {
							that.id = res.data.list[0].id;
							that.urls = 'https://api.huanti3d.com/?type=1&id=' + that.id + '&Authorization=' + uni
								.getStorageSync(
									'accessToken');
							// that.urls = 'https://test.huanti3d.com/?id=' + that.id + '&Authorization=' + uni
						} else {
							uni.showToast({
								title: res.msg,
								icon: 'none'
							});
						}
					});
			},
		}
	}
</script>

<style lang="scss">
</style>